﻿using CatUtils.Utils.Currency;
using CatUtils.Utils.Currency.TextUtils;
using RabbitDownload.Helper.Currency;
using System;
using System.Windows.Forms;

namespace RabbitDownload.WebSite.Yande.Tag
{
    public partial class YandeBatchTagControl : UserControl
    {
        public YandeBatchTagControl()
        {
            InitializeComponent();
            InitView();
        }

        private void InitView()
        {
            comboBox1.SelectedIndex = 0;
            YandeStaticValue.ImgScore = TextHelper.StringToInt(textBox3.Text);
            YandeStaticValue.ExcludeFlag = checkBox1.Checked;
        }

        private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
        {
            Helper.ViewHelper.TextBoxHelper.PrintCount(e);
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            Helper.ViewHelper.TextBoxHelper.PrintCount(e);
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            Helper.ViewHelper.TextBoxHelper.PrintCount(e);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BatchRun();
        }

        private void BatchRun()
        {
            foreach (string line in richTextBox1.Lines)
            {
                Console.WriteLine(line);
                if (line != "")
                {
                    YandeTagScanner.StartForCount(line.Trim(), TextHelper.StringToInt(textBox2.Text));
                    Console.WriteLine("批量模式扫描：" + line);
                }
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            YandeStaticValue.DownLoadMode = comboBox1.Text;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            YandeStaticValue.ExcludeFlag = checkBox1.Checked;
        }
    }
}